env GO111MODULE=on

# Regression test for golang.org/issue/29773: 'go list -m' was not following
# dependencies through older versions of the main module.

go list -f '{{with .Module}}{{.Path}}{{with .Version}} {{.}}{{end}}{{end}}' all
cmp stdout pkgmods.txt

go list -m all
cmp stdout mods.txt

go mod graph
cmp stdout graph.txt

-- go.mod --
module golang.org/issue/root

go 1.12

replace (
	golang.org/issue/mirror v0.1.0 => ./mirror-v0.1.0
	golang.org/issue/pkg v0.1.0 => ./pkg-v0.1.0
	golang.org/issue/root v0.1.0 => ./root-v0.1.0
)

require golang.org/issue/mirror v0.1.0

-- root.go --
package root

import _ "golang.org/issue/mirror"

-- mirror-v0.1.0/go.mod --
module golang.org/issue/mirror

require golang.org/issue/root v0.1.0

-- mirror-v0.1.0/mirror.go --
package mirror

import _ "golang.org/issue/pkg"

-- pkg-v0.1.0/go.mod --
module golang.org/issue/pkg

-- pkg-v0.1.0/pkg.go --
package pkg

-- root-v0.1.0/go.mod --
module golang.org/issue/root

require golang.org/issue/pkg v0.1.0

-- pkgmods.txt --
golang.org/issue/mirror v0.1.0
golang.org/issue/pkg v0.1.0
golang.org/issue/root
-- mods.txt --
golang.org/issue/root
golang.org/issue/mirror v0.1.0 => ./mirror-v0.1.0
golang.org/issue/pkg v0.1.0 => ./pkg-v0.1.0
-- graph.txt --
golang.org/issue/root go@1.12
golang.org/issue/root golang.org/issue/mirror@v0.1.0
go@1.12 toolchain@go1.12
golang.org/issue/mirror@v0.1.0 golang.org/issue/root@v0.1.0
golang.org/issue/root@v0.1.0 golang.org/issue/pkg@v0.1.0
